package net.oschina.dajiangnan.wx.constants;

import java.util.Timer;

import net.oschina.dajiangnan.wx.process.mp.tools.TickRefreshTask;

public class DynamicValue {

	private static final int tickRefreshTaskPeriod = 3600;
    private static TickRefreshTask  tickRefreshTask = new TickRefreshTask();
    
    
    public static void startGet(){
    	timer.schedule(DynamicValue.tickRefreshTask, 1000, tickRefreshTaskPeriod*1000);
    }
    
    
    
    public static String getAccessToken(){
        return tickRefreshTask.getAccessToken();
    }
    public static String getJsApiTicket(){
        return tickRefreshTask.getJsApiTicket();
    }
    public static boolean isAllowIp(String ip){
        for(String allowIp : tickRefreshTask.getIps().getIp_list()){
            if(ip.equals(allowIp)){
                return true;
            }
        }
        return false;
    }
    
    private static Timer timer = new Timer();
    
    
    
    
}
